package com.bs.service;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bs.entity.Admin;
import com.bs.mapper.AdminMapper;
import org.springframework.stereotype.Service;

@Service
public class AdminService extends ServiceImpl<AdminMapper, Admin> {
    public Boolean updatePwd(Integer id, String password, String rePassword) {
        if (password.equals(rePassword)) {
//            QueryWrapper<Admin> AdminQueryWrapper = new QueryWrapper<>();
//            AdminQueryWrapper.lambda().eq(Admin::getId,id)
            UpdateWrapper<Admin> AdminUpdateWrapper = new UpdateWrapper<>();
            AdminUpdateWrapper.lambda().set(Admin::getPassword,rePassword).eq(Admin::getId,id);
            return this.update(AdminUpdateWrapper);
        }else {
            return false;
        }
    }
}
